package eu.irreality.dai.ui.keyboard;

import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;

/**
 * First-level KeyEventDispatcher. It ensures that the KeyReceiver is interested
 * in the keystroke received before addressing it to the KeyListeners.
 * 
 */
public class EventDispatcher implements KeyEventDispatcher
{

    private JFrame frame;

    private KeyboardFocusManager manager;

    public EventDispatcher(JFrame frame, KeyboardFocusManager manager)
    {
	this.frame = frame;
	this.manager = manager;
    }

    public boolean dispatchKeyEvent(KeyEvent e)
    {
	manager.redispatchEvent(frame, e);
	return true;
    }
}
